//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    public class PictureNonVisual : IOfficeXmlSerializable
    {
        private NonVisualPictureProperties cNvPicPr;
        private NonVisualDrawingProperties cNvPr;

        public NonVisualDrawingProperties NonVisualDrawingProps
        {
            get
            {
                if (cNvPr == null)
                    cNvPr = new NonVisualDrawingProperties();
                return cNvPr;
            }
            set { cNvPr = value; }
        }

        public NonVisualPictureProperties NonVisualPictureProperties
        {
            get
            {
                if (cNvPicPr == null)
                    cNvPicPr = new NonVisualPictureProperties();
                return cNvPicPr;
            }
            set { cNvPicPr = value; }
        }

        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (var c = context.Read("nvPicPr"))
            {
                cNvPr = c.ReadElement<NonVisualDrawingProperties>();
                cNvPicPr = c.ReadElement<NonVisualPictureProperties>();
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("nvPicPr"))
            {
                c.WriteElement(NonVisualDrawingProps);
                c.WriteElement(NonVisualPictureProperties);
            }
        }

        #endregion
    }
}